package com.mengdie.shuidi.ui.adapter;

import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mengdie.shuidi.R;
import com.mengdie.shuidi.model.PackageEntity;

import java.util.List;

/**
 * 作者：HQY on 17/10/17 13:11
 * 邮箱：hqy_xz@126.com
 */

public class PackageAdapterV2 extends BaseQuickAdapter<PackageEntity, BaseViewHolder> {


    public PackageAdapterV2(List<PackageEntity> data) {
        super(R.layout.item_package_v2, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PackageEntity item) {

        ImageView ivCheck = helper.getView(R.id.iv_package_check);
        TextView tvOrgainMoney = helper.getView(R.id.tv_package_orgain_money);

        helper.setText(R.id.tv_package_name, item.getName())
                .setText(R.id.tv_package_show_money, "￥" + item.getShowPrice());
        tvOrgainMoney.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        tvOrgainMoney.setText("￥" + item.getOriginPrice());

        if (item.isCheck()) {
            ivCheck.setSelected(true);
        } else {
            ivCheck.setSelected(false);
        }

    }
}
